<template>
  <div @touchmove.prevent ref="app">
    <CVideo
      ref="c_video"
      @selected="selectTagItem"
      v-if="this.videoData"
      :videoData="this.videoData"
    ></CVideo>
    <template v-if="selectTag">
      <div
        style="cursor: pointer"
        class="box_btn_left_back"
        v-if="
          playStatus == 'loop' &&
            playTagName != 'home' &&
            this.$store.state.globalBackStatus
        "
        @click="clickBtnPre"
      >
        <img :src="selectTag.img" v-if="this.$store.state.selectTagImg" />
        <div
          class="box_selectTagImg_name"
          v-if="this.$store.state.selectTagImg"
        >
          <span style="padding-right: 5px; margin-left: 80px"
            >←{{ selectTag.name }}</span
          >
        </div>
      </div>
      <div
        class="close"
        v-if="playTagName != 'home' && this.$store.state.globalHomeStatus"
        @click="clickClose"
      >
        <img
          v-if="this.$store.state.homeBack"
          :src="
            'https://res-static.hc-cdn.cn/cloudbu-site/china/zh-cn/关于华为云/exibihition/Hall/ui/home_back.png'
          "
        />
      </div>
    </template>
    <!-- 三个按钮 -->
    <div class="img-list" v-if="this.$store.state.imgListStatus">
      <div class="explain">
        <a href="https://www.huaweicloud.com/about/exibihition/index.html">
          <div class="select-img-gohome"></div>
        </a>
      </div>
      <a href="https://www.huaweicloud.com/consultation/">
        <div class="explain">
          <div class="select-img-serve"></div>
        </div>
      </a>
      <div class="explain" @click="load_wrap = true">
        <div class="select-img-load"></div>
      </div>
    </div>
    <!-- 全部遮罩 -->
    <div class="load_wrap" v-if="load_wrap">
      <div class="code_wrap">
        <div class="qrCode">
          <img
            class="code"
            src="https://res-static.hc-cdn.cn/cloudbu-site/china/zh-cn/关于华为云/exibihition/Hall/ui/xin-zeng/QR-ccode/qrCode.png"
            alt="二维码"
          />
          <img
            @click="load_wrap = false"
            class="close-img"
            src="https://res-static.hc-cdn.cn/cloudbu-site/china/zh-cn/关于华为云/exibihition/Hall/ui/xin-zeng/close/close.png"
            alt="二维码"
          />
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import CVideo from "@com/CVideo.vue";
import axios from "axios";

export default {
  data() {
    return {
      videoData: null,
      selectTag: null,
      load_wrap: false
    };
  },
  components: {
    CVideo
  },
  computed: {
    playStatus() {
      return this.$refs.c_video.currentStatus;
    },
    playTagName() {
      return this.$refs.c_video.currentPlayItem.name;
    }
  },
  methods: {
    clickClose() {
      this.$refs.c_video.closeTag();
      this.$store.commit("setSpeciaStatus", null);
    },
    clickBtnPre() {
      if (this.selectTag.content !== undefined) {
        this.$store.commit("setSelectContent", this.selectTag.content);
      } else {
        this.$store.commit("setSelectContent", []);
      }
      console.log(this.$store.state.selectContent);
      this.$refs.c_video.fadeNextOne();
      this.$store.commit("setSpeciaStatus", null);
    },
    selectTagItem(tag) {
      this.selectTag = tag;
      console.log("selectTag" + this.selectTag.content);
    }
  },
  mounted() {
    console.log(
      " 首次",
      document.documentElement.clientWidth,
      document.documentElement.clientHeight
    );
    axios.get("./config/video.json").then(data => {
      this.videoData = data.data;
    });
  }
};
</script>

<style lang="scss" scoped>
.box_btn_left_back {
  width: 400px;
  height: 80px;
  position: absolute;
  left: 2vw;
  top: 2vh;
  img {
    width: 400px;
    height: 80px;
  }
  .box_selectTagImg_name {
    position: relative;
    white-space: nowrap;
    text-align: center;
    width: 300px;
    height: 80px;
    top: -80px;
    line-height: 69px;
  }
}
.close {
  position: absolute;
  right: 40px;
  top: 2vh;
  width: 70px;
  height: 70px;
  img {
    width: 100%;
  }
}
.close:hover {
  transform: scale(1.1, 1.1);
  cursor: pointer;
}
#app {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.compatibleStyle {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden; /* Chrome 和 Safari */
  -moz-backface-visibility: hidden; /* Firefox */
  -ms-backface-visibility: hidden; /* Internet Explorer */
  perspective: 0;
  -webkit-perspective: 0;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  visibility: visible;
}
.ceshi {
  position: absolute;
  top: 0;
  left: 0;
}
a {
  text-decoration: none;
  color: #ffffff;
}
.img-list {
  position: fixed;
  display: flex;
  flex-direction: column;
  top: 120px;
  right: 10px;
  font-family: "方正兰亭中黑";
  .explain {
    cursor: pointer;
    text-align: center;
    color: #ffffff;
    margin-bottom: 0px;
    .select-img-gohome {
      width: 123px;
      height: 100px;
      background-image: url("https://res-static.hc-cdn.cn/cloudbu-site/china/zh-cn/关于华为云/exibihition/Hall/ui/xin-zeng/btn/gohome.png");
      background-size: cover;
    }
    .select-img-gohome:hover {
      background-image: url("https://res-static.hc-cdn.cn/cloudbu-site/china/zh-cn/关于华为云/exibihition/Hall/ui/xin-zeng/btn/gohome_select.png");
    }
    .select-img-serve {
      width: 85px;
      height: 102px;
      background-image: url("https://res-static.hc-cdn.cn/cloudbu-site/china/zh-cn/关于华为云/exibihition/Hall/ui/xin-zeng/btn/serve.png");
      background-size: cover;
      margin-left: 20px;
    }
    .select-img-serve:hover {
      background-image: url("https://res-static.hc-cdn.cn/cloudbu-site/china/zh-cn/关于华为云/exibihition/Hall/ui/xin-zeng/btn/serve_select.png");
    }
    .select-img-load {
      width: 85px;
      height: 102px;
      background-image: url("https://res-static.hc-cdn.cn/cloudbu-site/china/zh-cn/关于华为云/exibihition/Hall/ui/xin-zeng/btn/load.png");
      background-size: cover;
      margin-left: 20px;
    }
    .select-img-load:hover {
      background-image: url("https://res-static.hc-cdn.cn/cloudbu-site/china/zh-cn/关于华为云/exibihition/Hall/ui/xin-zeng/btn/load_select.png");
    }
  }
}
.load_wrap {
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  position: absolute;
  top: 0px;
  left: 0px;
  z-index: 5000;
  // display: none;
}
.code_wrap {
  width: 600px;
  height: 450px;
  background-color: rgba(0, 0, 0, 0.5);
  position: absolute;
  top: 50%;
  left: 50%;
  margin-left: -300px;
  margin-top: -225px;
  border-radius: 10px;
  .qrCode {
    position: relative;
    width: 600px;
    height: 450px;
    .code {
      position: absolute;
      top: 50%;
      left: 50%;
      margin-left: -150px;
      margin-top: -150px;
      width: 300px;
      height: 300px;
    }
    .close-img {
      cursor: pointer;
      position: absolute;
      right: -30px;
      top: -30px;
      width: 60px;
      height: 60px;
    }
  }
}
</style>
